package com.atguigu.yygh.user.controller.user;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.user.prop.WeixinProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Component
@RequestMapping("user/userinfo/wx")
public class WeiXinController {

//    通过注入application.properties获取的各种属性值
    @Autowired
    private WeixinProperties weixinProperties;

    @RequestMapping("/param")
    @ResponseBody
    public R getWeixinLoginParam(){
        Map<String,Object> map = new HashMap<>();
        map.put("appid",weixinProperties.getAppid());
        map.put("scope","snsapi_login");
        map.put("redirecturl",weixinProperties.getRedirecturl());
        return R.ok().data(map);
    }


}
